package com.crm.business.crm.service;

import com.crm.business.servlet.BaseService;
import com.crm.common.agreement.entity.PO.BillAgreementTemplate;
import com.crm.common.crm.common.CrmModel;
import com.crm.common.crm.entity.BO.*;
import com.crm.common.crm.entity.PO.CrmAgreement;
import com.crm.common.crm.entity.PO.CrmLeads;
import com.crm.common.crm.entity.PO.CrmTmkLeads;
import com.crm.common.crm.entity.VO.CrmDataCheckVO;
import com.crm.common.crm.entity.VO.CrmInfoNumVO;
import com.crm.common.crm.entity.VO.CrmLeadsTransferCustomer;
import com.crm.common.crm.entity.VO.CrmModelFiledVO;
import com.crm.common.ka.core.entity.BasePage;
import com.crm.common.ka.core.feign.crm.entity.CrmEventBO;
import com.crm.common.ka.core.feign.crm.entity.QueryEventCrmPageBO;
import com.crm.common.ka.core.servlet.upload.FileEntity;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface ICrmAgreementService extends BaseService<CrmAgreement> {


    /**
     * 查询字段配置
     *
     * @param id 主键ID
     * @return data
     */
    public List<CrmModelFiledVO> queryField(Integer id);


    /**
     * 分页查询
     *
     * @param search
     * @return
     */
    public BasePage<Map<String, Object>> queryPageList(@RequestBody CrmSearchBO search);

    /**
     * 查询字段配置
     *
     * @param id 主键ID
     * @return data
     */
    public CrmModel queryById(Integer id);

    /**
     * 保存或新增信息
     *
     * @param crmModel model
     * @param isExcel 是否excel
     */
    public Map<String,String> addOrUpdate(CrmAgreementSaveBO crmModel, boolean isExcel);

    /**
     * 是否可发起签署
     * @return
     */
    public boolean canSubmit();
    /**
     * 保存数据
     * @param saveBO
     * @param isExcel
     * @param template
     * @param contractNo
     * @param signUrl
     * @param crmAgreement
     */
    public void saveData(CrmAgreementSaveBO saveBO, boolean isExcel, BillAgreementTemplate template, String contractNo, String signUrl, CrmAgreement crmAgreement);

        /**
         * 全部导出
         *
         * @param response resp
         * @param search   搜索对象
         */
    public void exportExcel(HttpServletResponse response, CrmSearchBO search);


    /**
     * 查询详情页基本信息
     * @param leadsId id
     * @return data
     */
    public List<CrmModelFiledVO> information(Integer leadsId);

    /**
     * 查询详情页数量
     * @param leadsId id
     * @return data
     */
    public CrmInfoNumVO num(Integer leadsId);

    /**
     * 查询文件列表
     * @param leadsId id
     * @return file
     */
    public List<FileEntity> queryFileList(Integer leadsId);

    public void updateInformation(CrmUpdateInformationBO updateInformationBO);

    public String  signAgreementCallBack(String contractNo,String signTime);

    /**
     * 获取合同信息
     *
     * @param contractNo
     * @return
     */
    public Map<String, Object> checkContract(String contractNo);

    public Map<String,Object> contractNum(Long cusotmerId,String customerType);

    public Map<String,Object> contractStatis();

    public void upAgreementNumCache(Integer upNum,Integer type);

    public BasePage<Map<String, Object>> queryAgreement(CrmAgreementPageBo pageEntity);

    public Map<String,Object> personAuth(String signUserName,String idCard,String telephone);
}
